package com.dudu.utils;

import org.apache.commons.lang.StringUtils;
import com.dudu.model.DataDictionary;
import com.dudu.dao.DataDictionaryDao;
import core.CoreDao;
import core.CoreDaoInvoke;

/**
 * 字典数据工具类
 * 
 * @author jack
 * 
 */
public class DictionaryUtils {

    private static CoreDao coreDao = CoreDaoInvoke.getInstance();

    public static String getValueByTypeAndKey(String type, String key) {
	String result = null;
	if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(key)) {
	    DataDictionaryDao dao = new DataDictionaryDao();
	    DataDictionary bean = dao.query(coreDao, type, key);
	    if (bean != null) {
		result = bean.getData_value();
	    }
	}

	return result;
    }

    public static void main(String[] args) {
	getValueByTypeAndKey("gzq", "appid");
    }
}
